/* remove all the large white rectangle waiting circle's from the DOM */
(function ($) {
	$.fn.removeWhiteSquareWaiting = function (options) {
		var defaults = {
		}

		options = $.extend(defaults, options);

		return this.each(function () {
			var item = $(this);
			var waitingDiv = item.find("div.whiteSquareWaiting");

			waitingDiv.remove();

		});
	}
}
)(jQuery);


/* show the large white rectangle waiting circle */
(function($){
	$.fn.showWhiteSquareWaiting = function(options){
		var defaults = {
			text:       "",
			callback:   null,
			container:	null
		}
		
		options = $.extend(defaults, options);
		
		return this.each(function(){
			var itemWidth = this.offsetWidth;
			var itemHeight = this.offsetHeight;
			var container = defaults.container || this;
			
			var div = $("<div class='whiteSquareWaiting'>" + options.text + "</div>");
			div.css({width: itemWidth + "px", height: itemHeight + "px"});
			
			$(container).append(div);
			
			div.position({
				my: "left top",
				at: "left top",
				of: this,
				offset: "0 0"
			});
			
			if(options.callback && typeof options.callback == "function"){
			    options.callback();
			}
			
		});
	}
}
)(jQuery);

